refactor: Dual path for rpc handlers - #3198
Conversation
…al-specs-move-errors
…al-specs-dual-path
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…al-specs-dual-path
mathbunnyru
left a comment
There was a problem hiding this comment.
I see lots of unrelated changes here too
Yeah, idk how stacking works here.. seems like it does not. I would not look at this before we merge the previous PRs in the series. |
There was a problem hiding this comment.
🔵 Needs a closer look
It changes core RPC dispatch semantics and error/warning plumbing across many modules and relies on external rpcspec behavior, so a human review plus CI confirmation is needed.
Pull request overview
This PR refactors RPC handler dispatch to support a second, typed-input path based on the shared xrpl-rpc-spec library (rpc::spec::HandlerFor<Input>), while keeping the existing “legacy” handler path intact. It also adds a helper for resolving spec::LedgerSpecifier into a ledger header, and updates Clio to consume error/warning types from rpcspec (including the updated “xrpld” wording), with no intended wire-level behavior changes beyond the already-noted warning text update.
Changes:
- Add a typed handler dispatch path in
rpc::impl::DefaultProcessorguarded by new concepts and a compile-time exclusivity check. - Introduce
getLedgerHeaderFromLedgerSpecifier(...)to resolve spec-libraryLedgerSpecifierto a backend ledger header with Clio’s validated-ledger semantics. - Migrate many includes/usages from
rpc/Errors.hppto<rpcspec/Errors.hpp>, rename forwarding-relatedClioErrorvalues, bumpxrpl-rpc-specto0.1.7, and update pinned tooling/action revisions.
File summaries
| File | Description |
|---|---|
| tests/unit/web/RPCServerHandlerTests.cpp | Switch to rpcspec errors; update clio warning message “rippled” → “xrpld”. |
| tests/unit/web/ng/RPCServerHandlerTests.cpp | Switch to rpcspec errors include. |
| tests/unit/web/ng/impl/ErrorHandlingTests.cpp | Switch to rpcspec errors include. |
| tests/unit/web/LoadWarningTests.cpp | Switch to rpcspec errors include. |
| tests/unit/web/impl/ErrorHandlingTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/RPCHelpersTests.cpp | Add coverage for getLedgerHeaderFromLedgerSpecifier (hash/seq/shortcuts/assert cases). |
| tests/unit/rpc/RPCEngineTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/VaultInfoTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/UnsubscribeTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/TxTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/TestHandlerTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/SubscribeTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/ServerInfoTests.cpp | Switch to rpcspec errors include; update renamed forwarding error enums in expectations. |
| tests/unit/rpc/handlers/LedgerTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/LedgerEntryTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/LedgerDataTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/DefaultProcessorTests.cpp | Add typed-path tests + static-asserts pinning which path each handler uses. |
| tests/unit/rpc/handlers/CredentialHelpersTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/AccountOffersTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/AccountLinesTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/AccountInfoTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/handlers/AccountCurrenciesTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/ForwardingProxyTests.cpp | Switch to rpcspec errors include; update renamed forwarding error enums in expectations. |
| tests/unit/rpc/ErrorTests.cpp | Update warning text expectation; update renamed forwarding error enums. |
| tests/unit/rpc/common/TypesTests.cpp | Remove rpc/Errors.hpp include (now via rpcspec where needed). |
| tests/unit/rpc/common/SpecsTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/common/CheckersTests.cpp | Switch to rpcspec errors include. |
| tests/unit/rpc/BaseTests.cpp | Switch to rpcspec errors include. |
| tests/unit/etl/SourceImplTests.cpp | Switch to rpcspec errors include; minor formatting. |
| tests/unit/etl/LoadBalancerTests.cpp | Switch to rpcspec errors include; update renamed forwarding error enums in expectations. |
| tests/unit/etl/ForwardingSourceTests.cpp | Switch to rpcspec errors include; update renamed forwarding error enums in expectations. |
| tests/unit/etl/ETLStateTests.cpp | Switch to rpcspec errors include; update renamed forwarding error enums in expectations. |
| tests/unit/app/WebHandlersTests.cpp | Switch to rpcspec errors include. |
| tests/integration/migration/cassandra/DBRawData.cpp | Formatting-only adjustment of closing braces/indentation. |
| tests/common/util/MockSource.hpp | Switch to rpcspec errors include. |
| tests/common/rpc/FakesAndMocks.hpp | Add typed-input fake + ADL spec hook + typed handler fakes (HandlerFor-based). |
| tests/common/rpc/FakesAndMocks.cpp | Add explicit HandlerFor<TypedInput> instantiation / defs include. |
| tests/common/CMakeLists.txt | Add new rpc/FakesAndMocks.cpp to testing common library sources. |
| src/web/ng/impl/ErrorHandling.cpp | Update forwarding ClioError enum names; include rpcspec errors. |
| src/web/impl/ErrorHandling.hpp | Update forwarding ClioError enum names in switch. |
| src/web/CMakeLists.txt | Link rpcspec::rpcspec into clio_web. |
| src/rpc/RPCHelpers.hpp | Declare getLedgerHeaderFromLedgerSpecifier; include rpcspec/Ledger.hpp. |
| src/rpc/RPCHelpers.cpp | Implement getLedgerHeaderFromLedgerSpecifier; switch to rpcspec errors/ledger includes. |
| src/rpc/handlers/VaultInfo.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/Unsubscribe.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/TransactionEntry.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/Subscribe.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/NoRippleCheck.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/NFTsByIssuer.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/NFTOffersCommon.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/NFTInfo.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/NFTHistory.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/MPTokenIssuanceHistory.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/MPTHolders.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/LedgerIndex.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/LedgerEntry.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/LedgerData.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/GetAggregatePrice.cpp | Remove rpc/Errors.hpp include. |
| src/rpc/handlers/GatewayBalances.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/Feature.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/DepositAuthorized.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AMMInfo.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountTx.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountOffers.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountObjects.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountNFTs.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountMPTokens.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountMPTokenIssuances.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountLines.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountInfo.cpp | Switch to rpcspec errors include; minor formatting. |
| src/rpc/handlers/AccountCurrencies.cpp | Switch to rpcspec errors include. |
| src/rpc/handlers/AccountChannels.cpp | Switch to rpcspec errors include. |
| src/rpc/Factories.cpp | Switch to rpcspec errors include. |
| src/rpc/Errors.hpp | Convert to rpcspec-backed error model (keep Clio-side info + JSON rendering declarations). |
| src/rpc/Errors.cpp | Implement Status streaming + update error-info table + forwarding error enum renames. |
| src/rpc/CredentialHelpers.cpp | Switch to rpcspec errors include. |
| src/rpc/common/Validators.cpp | Switch to rpcspec errors include. |
| src/rpc/common/Specs.hpp | Doc comment tweaks (remove @ref noise). |
| src/rpc/common/Specs.cpp | Switch to rpcspec errors include. |
| src/rpc/common/MetaProcessors.cpp | Switch to rpcspec errors include. |
| src/rpc/common/impl/Processors.hpp | Add typed handler dispatch path + compile-time exclusivity guard + warnings JSON conversion. |
| src/rpc/common/Concepts.hpp | Add SomeHandlerWithTypedInput + kIsSingleInputPath; update SomeHandler to include typed path. |
| src/rpc/common/AnyHandler.hpp | Doc comment tweak (remove @ref noise). |
| src/feed/CMakeLists.txt | Link rpcspec::rpcspec into clio_feed. |
| src/etl/Source.hpp | Switch to rpcspec errors include. |
| src/etl/LoadBalancer.cpp | Switch to rpcspec errors include; update forwarding error enum names. |
| src/etl/impl/SourceImpl.hpp | Switch to rpcspec errors include. |
| src/etl/impl/ForwardingSource.hpp | Switch to rpcspec errors include. |
| src/etl/impl/ForwardingSource.cpp | Switch to rpcspec errors include; update forwarding error enum names. |
| src/etl/CMakeLists.txt | Link rpcspec::rpcspec into clio_etl. |
| src/app/WebHandlers.cpp | Include rpcspec errors. |
| conanfile.py | Bump xrpl-rpc-spec dependency to 0.1.7. |
| conan.lock | Update lockfile entry for xrpl-rpc-spec/0.1.7. |
| .pre-commit-config.yaml | Bump pinned clang-format mirror + gersemi hook revisions. |
| .github/workflows/docs.yml | Bump actions/deploy-pages pin to v5.0.1. |
| .github/actions/build-docker-image/action.yml | Bump docker/setup-qemu-action pin to v4.3.0. |
Review details
- Files reviewed: 22/24 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Started from #3173
Adds a second dispatch path so handlers can use the shared rpc-spec (
HandlerFor<Input>), plus theLedgerSpecifier→ ledger-header helper they'll need — no handler migrates, nothing changes on the wire.